<template>
  <div class="outer">
    <button @click="getMovieList1">点击获取电影列表</button>
    <button @click="getMovieList">点击获取电影列表mapActions</button>
    <ul>
      <li v-for="item in movieList" :key="item.tvId">{{ item.albumName }}</li>
    </ul>
    <h1>电影名称长度不超过5个字</h1>
    <ul>
      <li v-for="item in myMovieList" :key="item.tvId">{{ item.albumName }}</li>
    </ul>
    <h1>电影长度在m-n之间</h1>
    <ul>
      <li v-for="item in yourMovieList" :key="item.tvId">{{ item.albumName }}</li>
    </ul>
  </div>
</template>

<script>
import { mapActions } from "vuex";
export default {
  name: "Header",
  computed: {
    movieList() {
      return this.$store.state.movieList;
    },
    myMovieList() {
      return this.$store.getters.myMovieList;
    },
    yourMovieList() {
      return this.$store.getters.yourMovieList({ m: 3, n: 7 });
    },
  },
  methods: {
    getMovieList1() {
      this.$store.dispatch("getMovieList");
    },
    ...mapActions(["getMovieList"]),
  },
};
</script>

<style scoped>
.outer {
  background: green;
}
</style>